package StudentDemon;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class StudentsTest {
    public static void main(String[] args) {
        Student student1 = new Student();
        student1.setName("张三");
        student1.setAge(14);
        Student student2 = new Student();
        student2.setName("李四");
        student2.setAge(13);
        Student student3 = new Student();
        student3.setAge(15);
        student3.setName("王五");
        StudentBiz studentBiz = new StudentBiz();
        studentBiz.addStudent(student1);
        studentBiz.addStudent(student2);
        studentBiz.addStudent(student3);
        //   studentBiz.ShowStudent();
        //比之前写的方便了许多，直接Collection接口，增加对象进去，然后重写，输出你想要的数据
        Collection col1 = new ArrayList();
        col1.add(student1);
        col1.add(student2);
        col1.add(student3);
        System.out.println(col1);
        //输出元素的话，内部会自动重写toString方法
        Collection col2 = new ArrayList() ;
        col2.add("A");
        col2.add("V");
        col2.add("C");
        System.out.println(col2);
        col1.remove(student1);//删除第一个对象
        System.out.println(col1);



    }
}